package com.fxnotes.book.utils;

import com.fxnotes.common.thread.Executable;
import com.fxnotes.common.thread.TaskExecutor;

public class TaskJavaExecutor implements TaskExecutor {

    @Override
    public void execute(final Executable executable) {

        new Thread(new Runnable() {

            @Override
            public void run() {
                try {
                    executable.execute();
                    executable.onSuccess();
                } catch (Exception ex) {
                    executable.onFail(ex.getMessage());
                }
            }
        }).start();
    }
}
